<template>
  <div style=" width: 99%; margin: auto;">
    <el-form :model="userForm" :rules="userRules" ref="userFormRef" label-position="right" label-width="130px">
      <el-row :gutter="20" type="flex" style="flex-wrap: wrap;margin: 20px;">
        <el-col style="margin-bottom: 15px;" :span="23">
          <span style="font-size: 18px;font-weight: bold;line-height: 36px;" @click="postInfo">基本信息</span>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="organizationBaseName" label="组织名称">
            <el-input v-model="userForm.organizationBaseName" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="unitNature" label="单位性质">
            <el-select clearable  v-model="userForm.unitNature" placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in unitNatureOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="supervisoryCode" label="业务主管单位">
            <el-select clearable  v-model="userForm.supervisoryCode" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in authorityOptions"
                :key="dict.deptId"
                :label="dict.deptName"
                :value="dict.deptId"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="supervisoryPhone" label="对外公开电话">
            <el-input type="number" v-model="userForm.supervisoryPhone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>

        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="registerNum" label="登记证号">
            <el-input v-model="userForm.registerNum" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="creditCode" label="统一社会信用代码">
            <el-input v-model="userForm.creditCode" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="practicingLicenseNum" label="执业许可证号">
            <el-input v-model="userForm.practicingLicenseNum" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="establishTime" label="成立时间">
            <el-date-picker
              style="width: 100%;"
              value-format="YYYY-MM-DD"
              v-model="userForm.establishTime"
              type="date"
              placeholder="选择日期">
            </el-date-picker>

          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="registerCapital" label="注册资金">
            <el-input type="number" v-model="userForm.registerCapital" placeholder="请输入">
              <template #append>万元</template>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="postalCode" label="邮政编码">
            <el-input type="number" v-model="userForm.postalCode" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="addressSource" label="住所来源">
            <el-select clearable  v-model="userForm.addressSource" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in abodeOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="registerAddress" label="住所">
            <el-input v-model="userForm.registerAddress" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="addressCounty" label="住所所在区县">
            <el-select clearable v-model="userForm.addressCounty" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in countyOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="contactsName" label="联系人">
            <el-input v-model="userForm.contactsName" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="contactsTelephone" label="联系电话">
            <el-input type="number" v-model="userForm.contactsTelephone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="contactsPhone" label="手机号码">
            <el-input type="number" v-model="userForm.contactsPhone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="websiteAddress" label="网站地址">
            <el-input v-model="userForm.websiteAddress" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="email" label="电子邮箱">
            <el-input v-model="userForm.email" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="24">
          <el-form-item prop="businessScope" label="业务范围">
            <el-input type="textarea" v-model="userForm.businessScope" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="24">
          <span style="font-size: 18px;font-weight: bold;line-height: 36px;">法定代表人</span>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="legalRepresentativeName" label="姓名">
            <el-input v-model="userForm.legalRepresentativeName" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="legalRepresentativeSex" label="性别">
            <el-select clearable  v-model="userForm.legalRepresentativeSex" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in sexOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="legalRepresentativeBirthday" label="出生日期">
            <el-date-picker
              style="width: 100%;"
              value-format="YYYY-MM-DD"
              v-model="userForm.legalRepresentativeBirthday"
              type="date"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="legalRepresentativePhone" label="电话">
            <el-input type="number" v-model="userForm.legalRepresentativePhone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="legalRepresentativeTelephone" label="手机号码">
            <el-input type="number" v-model="userForm.legalRepresentativeTelephone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="24">
          <span style="font-size: 18px;font-weight: bold;line-height: 36px;">理（董）事会、监事会及行政负责人</span>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="supervisory" label="是否设立监事会">
            <el-select clearable  v-model="userForm.supervisory" placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in shiOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>

        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="directorPeopleNum" label="理事人数">
            <el-input type="number" v-model="userForm.directorPeopleNum" disabled placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="supervisoryPeopleNum" label="监事（会）人数">
            <el-input type="number" v-model="userForm.supervisoryPeopleNum" disabled placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="24">
          <span style="font-size: 18px;font-weight: bold;line-height: 36px;">理（董） 事长</span>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanName" label="姓名">
            <el-input v-model="userForm.chairmanName" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanSex" label="性别">
            <el-select clearable  v-model="userForm.chairmanSex" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in sexOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanBirthday" label="出生日期">
            <el-date-picker
              style="width: 100%;"
              value-format="YYYY-MM-DD"
              v-model="userForm.chairmanBirthday"
              type="date"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanPolitics" label="政治面貌">
            <el-select clearable  v-model="userForm.chairmanPolitics" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in politicsOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanQualification" label="学历">
            <el-select clearable  v-model="userForm.chairmanQualification" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in xueliOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanFullTime" label="是否专职">
            <el-select clearable  v-model="userForm.chairmanFullTime" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in shiOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanDirectorUnitPosition" label="工作单位及职务">
            <el-input v-model="userForm.chairmanDirectorUnitPosition" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanPhone" label="电话">
            <el-input type="number" v-model="userForm.chairmanPhone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="chairmanTelephone" label="手机号码">
            <el-input type="number" v-model="userForm.chairmanTelephone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="24">
          <span style="font-size: 18px;font-weight: bold;line-height: 36px;">行政负责人</span>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleName" label="姓名">
            <el-input v-model="userForm.responsibleName" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleSex" label="性别">
            <el-select clearable  v-model="userForm.responsibleSex" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in sexOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleBirthday" label="出生日期">
            <el-date-picker
              style="width: 100%;"
              value-format="YYYY-MM-DD"
              v-model="userForm.responsibleBirthday"
              type="date"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsiblePolitics" label="政治面貌">
            <el-select clearable  v-model="userForm.responsiblePolitics" placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in politicsOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleQualification" label="学历">
            <el-select clearable  v-model="userForm.responsibleQualification" placeholder="请完善"
                       style="width: 100%;">
              <el-option
                v-for="dict in xueliOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleFullTime" label="是否专职">
            <el-select clearable  v-model="userForm.responsibleFullTime" filterable placeholder="请完善" style="width: 100%;">
              <el-option
                v-for="dict in shiOptions"
                :key="dict.id"
                :label="dict.name"
                :value="dict.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsiblePhone" label="电话">
            <el-input type="number" v-model="userForm.responsiblePhone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleQQ" label="QQ">
            <el-input type="number" v-model="userForm.responsibleQQ" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
        <el-col style="margin-bottom: 15px;" :span="12">
          <el-form-item prop="responsibleTelephone" label="移动电话">
            <el-input type="number" v-model="userForm.responsibleTelephone" placeholder="请输入"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div style="margin-top: 15px;"><p>注：</p>
      <p>1.理事人数为3-25人；</p>
      <p>2.若设监事会，监事人数至少为3人；</p></div>
  </div>
</template>
<script>

import {
  getAuthorityDept,
  getDictByCode,
  getListAuthority,
  getTableInfoByPage,
  mfSaveBase
} from '@/views/yearCheck/ykb/mf/mf'

export default {
  data() {
    return {
      abodeOptions: undefined,
      xueliOptions: undefined,
      politicsOptions: undefined,
      unitNatureOptions: undefined,
      countyOptions: undefined,
      authorityOptions: undefined,
      selectTests: [{ id: '1', name: '民政局' }, { id: '2', name: '公安局' }],
      sexOptions: [{ id: '1', name: '男' }, { id: '2', name: '女' }],
      shiOptions: [{ id: '1', name: '是' }, { id: '2', name: '否' }],
      userForm: {
        // unitNature: 221,//单位性质
        // supervisoryUnit: '民政局',//业务主管单位
        // supervisoryCode: 1,//主管单位编码
        // supervisoryPhone: '19132871315',//对外公开电话
        // businessScope: '开展社会组织服务、孵化工作、公益活动策划及创投、场地提供、提供社工服务、开展社会公益相关活动，搭建社会组织及社区便民服务平台',//业务范围
        // registerNum: '50072',//登记证号
        // creditCode:localStorage.getItem("creditCode"),//统一社会信用代码
        // practicingLicenseNum: '00010001',//执业许可证号
        // establishTime: '2021-09-02',//($date-time)成立时间
        // registerCapital: '3',//注册资金
        // postalCode: '404505',//邮政编码
        // addressSource: 223,//住所/注册地址来源
        // addressCounty: 230,//住所/注册地址所在区县
        // registerAddress: '云阳县双江街道天鹅路 1号综合办公室底楼',//住所/注册地址
        // contactsName: '解超',//联系人姓名
        // contactsTelephone: '55752559',//联系人电话
        // contactsPhone: '17611400925',//联系人手机
        // websiteAddress: 'www.baidu.com',//网站地址
        // email: '971757769@qq.com',//电子邮箱
        // legalRepresentativeName: '法定代表',//法定代表人
        // legalRepresentativeSex: 1,//法定代表人性别1-男，2-女 0-未知
        // legalRepresentativeBirthday: '2021-10-10',//($date-time)法定代表人出生日期
        // legalRepresentativePhone: '55752558',//法定代表人电话
        // legalRepresentativeTelephone: '19132870003',//法定代表人手机
        // //是否设立监事会
        // directorPeopleNum: '',//理事人数
        // supervisoryPeopleNum: '',//监事会人数
        // chairmanName: '理事长姓名',//理事长姓名`
        // chairmanSex: 1,//理事长性别`
        // chairmanBirthday: '2021-10-10',//($date-time)理事长出生日期
        // chairmanPolitics: 295,//理事长政治面貌
        // chairmanQualification: 23,//理事长学历`
        // chairmanFullTime: 1,//理事长是否专职
        // chairmanDirectorUnitPosition: '工作单位职务',//理事长单位及职务/原单位/社会组织职务
        // chairmanPhone: '55752558',//理事长联系方式`
        // chairmanTelephone: '19132870001',//理事长手机
        // responsibleName: '负责人',//负责人姓名`
        // responsibleSex: 2,//负责人性别`
        // responsibleBirthday: '2021-10-10',//($date-time)负责人出生日期
        // responsiblePolitics: 295,//负责人政治面貌
        // responsibleQualification: 23,//负责人学历`
        // responsibleFullTime: 1,//负责人是否专职
        // responsiblePhone: '55752557',//负责人联系方式`
        // responsibleQQ: '971757769',//负责人QQ
        // responsibleTelephone: '19132870002',//负责人手机号`
        // examineYear: localStorage.getItem("examineYear"),//申报年度
        // legalRepresentativeEducation: '',//法定代表人学历
        // organizationBaseName: '',//姓名
        // legalRepresentativePolitics: '',//法定代表人政治面貌`
        // legalRepresentativePost: '',//法定代表人职务
        // responsibleDirectorUnitPosition: '',//负责人单位及职务/原单位/社会组织职务
      },
      userRules: {
        organizationBaseName: [{ required: true, message: '请完善', trigger: 'blur' }],
        businessScope: [{ required: true, message: '请完善', trigger: 'blur' }],
        creditCode: [{ required: true, message: '请完善', trigger: 'blur' }],
        // registerNum: [{ required: true, message: '请完善', trigger: 'blur' }],
        establishTime: [{ required: true, message: '请完善', trigger: 'blur' }],
        registerCapital: [{ required: true, message: '请完善', trigger: 'blur' }],
        registerAddress: [{ required: true, message: '请完善', trigger: 'blur' }],
        unitNature: [{ required: true, message: '请完善', trigger: 'blur' }],
        supervisoryCode: [{ required: true, message: '请完善', trigger: 'blur' }],
        // supervisoryPhone: [{ required: true, message: '请完善', trigger: 'blur' },{
        //   pattern: /^\d{3}(-{0,1})(\d{8})?$/,
        //   message: '电话格式不正确',
        //   trigger: 'blur'}],
        // practicingLicenseNum: [{ required: true, message: '请完善', trigger: 'blur' }],
        postalCode: [{ required: true, message: '请完善', trigger: 'blur' }, {
          pattern: /^[1-9]\d{5}$/,
          message: '邮编格式不正确',
          trigger: 'blur'
        }],
        addressSource: [{ required: true, message: '请完善', trigger: 'blur' }],
        addressCounty: [{ required: true, message: '请完善', trigger: 'blur' }],
        contactsName: [{ required: true, message: '请完善', trigger: 'blur' }],
        // contactsTelephone: [{ required: true, message: '请完善', trigger: 'blur' }],
        contactsPhone: [{ required: true, message: '请完善', trigger: 'blur' }, {
          pattern: /^1[3-9]\d{9}$/,
          message: '手机号格式不正确',
          trigger: 'blur'
        }],
        // websiteAddress: [{ required: true, message: '请完善', trigger: 'blur' }],
        // email: [{
        //   required: true,
        //   message: '请完善',
        //   trigger: 'blur'
        // }, {
        //   pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/,
        //   message: '邮箱格式不正确',
        //   trigger: 'blur'
        // }],
        legalRepresentativeName: [{ required: true, message: '请完善', trigger: 'blur' }],
        legalRepresentativeSex: [{ required: true, message: '请完善', trigger: 'blur' }],
        legalRepresentativeBirthday: [{ required: true, message: '请完善', trigger: 'blur' }],
        legalRepresentativeTelephone: [{
          required: true,
          message: '请完善',
          trigger: 'blur'
        }, { pattern: /^1[3-9]\d{9}$/, message: '手机号格式不正确', trigger: 'blur' }],
        // legalRepresentativePhone: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanName: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanSex: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanBirthday: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanPolitics: [{ required: true, message: '请完善', trigger: 'blur' }],
        supervisory: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanQualification: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanFullTime: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanDirectorUnitPosition: [{ required: true, message: '请完善', trigger: 'blur' }],
        // chairmanPhone: [{ required: true, message: '请完善', trigger: 'blur' }],
        chairmanTelephone: [{ required: true, message: '请完善', trigger: 'blur' }, {
          pattern: /^1[3-9]\d{9}$/,
          message: '手机号格式不正确',
          trigger: 'blur'
        }],
        responsibleName: [{ required: true, message: '请完善', trigger: 'blur' }],
        responsibleSex: [{ required: true, message: '请完善', trigger: 'blur' }],
        responsibleBirthday: [{ required: true, message: '请完善', trigger: 'blur' }],
        responsiblePolitics: [{ required: true, message: '请完善', trigger: 'blur' }],
        responsibleQualification: [{ required: true, message: '请完善', trigger: 'blur' }],
        responsibleFullTime: [{ required: true, message: '请完善', trigger: 'blur' }],
        // responsiblePhone: [{ required: true, message: '请完善', trigger: 'blur' }],
        responsibleTelephone: [{ required: true, message: '请完善', trigger: 'blur' }, {
          pattern: /^1[3-9]\d{9}$/,
          message: '手机号格式不正确',
          trigger: 'blur'
        }],
        // responsibleQQ: [{ required: true, message: '请完善', trigger: 'blur' }]
      }
    }
  },
  created() {

  },
  methods: {
    getInfo() {
      getDictByCode('abode').then(response => {
        this.abodeOptions = response.data
      })
      getDictByCode('xueli').then(response => {
        this.xueliOptions = response.data
      })
      //秘书长产生方式
      getDictByCode('politics').then(response => {
        this.politicsOptions = response.data
      })
      //社团职务
      getDictByCode('unitNature').then(response => {
        this.unitNatureOptions = response.data
      })
      getAuthorityDept().then(response => {
        this.authorityOptions = response.data;
        // this.authorityOptions.push({"deptId":"GO_1560457202370744320","id":"65883","deptName": "云阳县工商联","parentId": "GO_1657988536883802112"});
      })
      // getListAuthority().then(response => {
      //   let json = response.data
      //   this.authorityOptions = []
      //   if (json != null) {
      //     for (let i = 0; i < json.length; i++) {
      //       if(json[i].deptName.indexOf('云阳') != -1){
      //         this.authorityOptions.push({ id: json[i].deptId + '', name: json[i].deptName + '' })
      //       }
      //     }
      //     let delStr = ['镇','领导','中学','街道','支行','医院','公司','集团','小学','企业','银行','办公室','乡','政府','政协','责任','项目','中队','人大','队','林场','仓库','基地','学校','三员','市直','管理','网格','研究','学院','群房','党商','烟草','厂商','政务'];
      //     for (let i = 0; i < delStr.length; i++) {
      //       for (let j = 0; j < this.authorityOptions.length; j++) {
      //         if(this.authorityOptions[j].name.indexOf(delStr[i]) >=0){
      //           this.authorityOptions.splice(j,1);
      //           j--;
      //         }
      //       }
      //     }
      //     console.log(this.authorityOptions)
      //   }
      // })
      getTableInfoByPage(1).then(response => {
        this.userForm = JSON.parse(JSON.stringify(response.data).replace(/null/g, '""'))
        console.log(this.userForm)
        this.userForm.organizationBaseName = localStorage.getItem('userName')
        this.userForm.creditCode = localStorage.getItem('creditCode')
        this.userForm.unitNature += ''
        if(this.userForm.unitNature == '0'){
          this.userForm.unitNature = '';
        }
        this.userForm.legalRepresentativeSex += ''
        this.userForm.chairmanSex += ''
        this.userForm.responsibleSex += ''
        this.userForm.addressCounty += ''
        this.userForm.supervisory += ''
        console.log(this.userForm)
        //所属区县
        getDictByCode('county').then(response => {
          this.countyOptions = response.data
          for (let i = 0; i < this.countyOptions.length; i++) {
            if(this.countyOptions[i].name.indexOf('云阳') != -1){
              this.userForm.addressCounty = this.countyOptions[i].id;
            }
          }
        })
      })
    },
    postInfo() {

      this.$refs.userFormRef.validate(valid => {
        let isSupervisory = false;
        for (let i = 0; i < this.authorityOptions.length; i++) {
          if(this.authorityOptions[i].deptId == this.userForm.supervisoryCode){
            isSupervisory = true;
          }
        }
        console.log(isSupervisory)
        if(!isSupervisory){
          this.$message({
            message: '请选择正确的主管单位！',
            type: 'error'
          })
          return;
        }
        if (valid) {
          this.userForm.creditCode = localStorage.getItem('creditCode')
          this.userForm.examineYear = localStorage.getItem('examineYear')
          this.userForm.organizationBaseId = '1'

          for (let i = 0; i < this.authorityOptions.length; i++) {
            if (this.authorityOptions[i].deptId == this.userForm.supervisoryCode) {
              this.userForm.supervisoryUnit = this.authorityOptions[i].deptName
            }
          }
          mfSaveBase(this.userForm).then(response => {
            this.$message({
              message: '保存基础信息成功',
              type: 'success'
            })
            this.getInfo()
          })
        } else {
          this.$message({
            message: '请填写相关内容！',
            type: 'error'
          })
        }
      })
    }
  }
}
</script>
<style scoped lang="scss">
.el-table {
  --el-table-row-hover-bg-color: rgba(39, 137, 238, 0.1);
  --el-table-border-color:#e0e5f0;
}
:deep(.el-card.is-always-shadow) {
  box-shadow: 0 1px 14px 0 rgba(209, 224, 239, 0.6)
}

/* 拉框选中 */
.el-select-dropdown__item {
  height: 24px;
  line-height: 24px;
  font-size: 12px;
}

/* 鼠标经过下拉框 */
.el-select-dropdown__item:hover {
  height: 24px;
  line-height: 24px;
  font-size: 12px;
}

.el-select-dropdown__item.selected {
  color: #2789EE;
}

:deep(.el-form-item__label) {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  text-align: right;
  height: 32px;
  line-height: 16px;
}

.app-container {
  margin-top: 40px;
  margin-left: 15%;
  width: 70%;
}

.div-bg {
  width: 100%;
  background: #F0F0F0;
  height: 10px;
}

.box-card {
  width: 100%;
  margin-top: 20px;
  padding: 20px;
}

.el-col {
  padding-left: 5px;
}

.divider-title {
  font-weight: bold;
  font-size: 18px;
}

.custom-select .el-select-dropdown {
  max-height: 600px; /* 设置为你想要的高度 */
  overflow: auto; /* 添加滚动条 */
}

table {
  border-collapse: collapse; /* 确保表格的边框合并为单一边框 */
  width: 100%; /* 表格宽度 */
}

td {
  border: 1px solid #adabab; /* 设置单线边框 */
  padding: 6px; /* 单元格内边距 */
}

.el-form-item {
  margin-bottom: 0px;
}
</style>
